// ActionScript file
import flash.events.Event;
import flash.events.MouseEvent;

private var _loggedIn:Boolean = false;

private function init():void {
	addEventListener("currentStateChange", onStateChanged);
}

private function loginClicked(event:MouseEvent):void {
	if (username.text != "" && password.text != "") {
		_loggedIn = true;
	}
	currentState = "normalState";
}

private function onStateChanged(event:Event):void {
	if (!_loggedIn) {
		if (currentState == "normalState") {
			loggedInBox.visible = false;
		}
	}
	else {
		welcomeText.text = "Welcome " + username.text;
	}
	
}